<?php

include "DBconn.php";

class SalesBrochure {

    public function slowMovingStock() {
        $ret = array();
        $compdate = date('Y-m-d', strtotime(date("Y-m-d", strtotime(date("Y-m-d"))) . " -120 day"));
        $s = mysql_query("Select serialnumber,pro_name,part_number,stamp_number,model_no,pro_description from product_header where activestatus=1") or die(mysql_error());
        while ($row = mysql_fetch_object($s)) {
            $result = mysql_query("SELECT SUM(do_pro_qty) as do_pro_qty FROM gr_do WHERE pro_serialnumber_fk='$row->serialnumber' and 
						do_date > '$compdate' and activestatus=1") or die(mysql_error());
            while ($row1 = mysql_fetch_object($result)) {
                $temp = new VoSalesBrochure();
                $temp->pro_serialnumber = (int) $row->serialnumber;
                $temp->pro_name = $row->pro_name;
                $temp->part_number = $row->part_number;
                $temp->pro_description = $row->pro_description;
				$temp->stamp_number = $row->stamp_number;
				$temp->model_no = $row->model_no;
                $temp->pro_stock = (int) $row1->do_pro_qty;
                $temp->isSelected = false;
                $ret[] = $temp;
            }
        }
        return $ret;
    }

}

class VoSalesBrochure {

    var $pro_serialnumber;
    var $pro_stock;
    var $pro_name;
    var $part_number;
	var $stamp_number;
	var $model_no;
    var $pro_description;
    var $isSelected;

}

//$sd=new SalesBrochure();
//echo $sd->slowMovingStock();
?>